package com.kly.chatter.api.application.controller.user.res;

import com.kly.user.dto.UserDialogDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
@ApiModel(description = "user 返回参数")
public class UserRes implements Serializable {

    @ApiModelProperty(value = "用户编号")
    private String userCode;

    @ApiModelProperty(value = "用户昵称")
    private String nickName;

    @ApiModelProperty(value = "性别 0未知、1男、2女、3武装直升机")
    private Integer gender;

    @ApiModelProperty(value = "头像地址")
    private String avatarUrl;

    @ApiModelProperty(value = "出生年月")
    private Date birthday;

    @ApiModelProperty(value = "年龄")
    private Integer age;

    @ApiModelProperty(value = "是否是会员")
    private int isMember;

    /**
     * 1-表示自我介绍、2-交友目的
     */
//    @ApiModelProperty(value = "总收入")
//    private Integer userProfileType;

    @ApiModelProperty(value = "交友目的")
    private String aboutMe;

    @ApiModelProperty(value = "是否有会话 0没有 1有")
    private int haveConnection;

    public static List<UserRes> toUserRes(List<UserDialogDto> userDialogDtoList) {
        List<UserRes> userResList = new ArrayList<>();
        for (UserDialogDto userDialogDto : userDialogDtoList) {
            UserRes userRes = new UserRes();
            userRes.setUserCode(userDialogDto.getUserCode());
            userRes.setNickName(userDialogDto.getNickName());
            userRes.setGender(userDialogDto.getGender());
            userRes.setAvatarUrl(userDialogDto.getAvatarUrl());
            userRes.setBirthday(userDialogDto.getBirthday());
            userRes.setAge(userDialogDto.getAge());
            userRes.setIsMember(0);
            userRes.setAboutMe(userDialogDto.getAboutMe());
            userRes.setHaveConnection(userDialogDto.getHaveConnection());
            userResList.add(userRes);
        }
        return userResList;
    }
}
